#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <math.h>

using namespace std;

// 2269. 找到一个数字的 K 美丽值
// https://leetcode.cn/problems/find-the-k-beauty-of-a-number/

class Solution1 {
public:
    int divisorSubstrings(int num, int k) {
        string str = to_string(num);
        int n = str.size();
        int left = 0;
        string curStr;
        int ans = 0;
        for (int i = 0; i < n; i++)
        {
            curStr += str[i];
            if(i - left + 1 < k){
                continue;
            }
            int curNum = stoi(curStr);
            if (curNum != 0 && num % curNum == 0)
            {
                ans++;
            }
            curStr.erase(0, 1);
            left++;
        }
        return ans;
    }
};

class Solution {
public:
    int divisorSubstrings(int num, int k) {
        long long mod = pow(10, k);
        int ans = 0;
        for (int i = num; i >= mod / 10; i /= 10)
        {
            int curNum = i % mod;
            if(curNum != 0 && num % curNum == 0){
                ans++;
            }
        }
        return ans;
    }
};

int main(){
    return 0;
}